home *** CD-ROM | disk | FTP | other *** search
/ Teach Your Children: Road Construction Ahead / Teach Your Children: Road Construction Ahead.iso / pc / rca / road.dxr / 00017_QTviewer Parent.ls < prev    next >
Encoding:
Text File  |  1996-07-17  |  4.4 KB  |  154 lines

  1. property firstButChan, constrainChan, QTchannel, fps, videoName, paletteName, slider, litButton, ticksPerFrame, frames, globalButtonsEnabled, returnScript, coverSprite
  2. global gActorList, gHiddenActorList, gRollAnimButton, gVTLobject, g3DObject, gVTLgameObject
  3.  
  4. on birth me
  5.   set constrainChan to 1
  6.   set firstButChan to 4
  7.   set QTchannel to 10
  8.   set fps to 15
  9.   set globalButtonsEnabled to 0
  10.   set ticksPerFrame to 60 / fps
  11.   set returnScript to "goMenu( gQTViewerObject )"
  12.   return me
  13. end
  14.  
  15. on setup me
  16.   set the directToStage of cast videoName to 1
  17.   set the sound of cast videoName to 1
  18.   set the castNum of sprite QTchannel to the number of cast videoName
  19.   set the pausedAtStart of cast videoName to 0
  20.   set the movieRate of sprite QTchannel to 1
  21.   puppetSprite(QTchannel, 1)
  22.   clearAllActors()
  23.   set litButton to EMPTY
  24.   set frames to (the duration of cast videoName / ticksPerFrame) - 1
  25.   set slider to birth(script "Slider Class", constrainChan, firstButChan, frames)
  26.   add(gHiddenActorList, birth(script "Rollover Anim Button Class", "returnFrom( gQTViewerObject, me )", 13, 13, 5, "A14VO01", "A14RO01"))
  27.   add(gHiddenActorList, birth(script "Rollover Anim Button Class", "help( gQTViewerObject, me )", 14, 14, 11, EMPTY, "RCA-05RO02"))
  28.   add(gActorList, me)
  29. end
  30.  
  31. on update me
  32.   if the movieRate of sprite QTchannel = 0 then
  33.     if not globalButtonsEnabled then
  34.       set globalButtonsEnabled to 1
  35.       showAllActors()
  36.     end if
  37.   else
  38.     set the currentChoice of slider to ((the movieTime of sprite QTchannel - 1) / 4) + 1
  39.     snapInMiddle(slider)
  40.   end if
  41.   if litButton <> EMPTY then
  42.     if the timer > 30 then
  43.       set the castNum of sprite litButton to the castNum of sprite litButton - 1
  44.       set litButton to EMPTY
  45.     end if
  46.   end if
  47. end
  48.  
  49. on sliderHandler me
  50.   pauseQT(me)
  51.   set the castNum of sprite the clickOn to the castNum of sprite the clickOn + 1
  52.   repeat while the stillDown
  53.     updateSlider(slider)
  54.     set the movieTime of sprite QTchannel to (the currentChoice of slider * ticksPerFrame) + 1
  55.     updateStage()
  56.   end repeat
  57.   set the castNum of sprite the clickOn to the castNum of sprite the clickOn - 1
  58.   snap(slider)
  59.   showAllActors()
  60.   set globalButtonsEnabled to 1
  61. end
  62.  
  63. on clickPauseButton me
  64.   if the movieRate of sprite QTchannel <> 0 then
  65.     puppetSound("qtClick")
  66.     set the castNum of sprite the clickOn to the castNum of sprite the clickOn + 1
  67.     pauseQT(me)
  68.     updateStage()
  69.     repeat while soundBusy(1)
  70.     end repeat
  71.     puppetSound(0)
  72.     set the castNum of sprite the clickOn to the castNum of sprite the clickOn - 1
  73.   end if
  74. end
  75.  
  76. on pauseQT me
  77.   set the sound of cast videoName to 0
  78.   set the movieRate of sprite QTchannel to 0
  79. end
  80.  
  81. on playForwards me
  82.   if the movieRate of sprite QTchannel <> 1 then
  83.     puppetSound("qtClick")
  84.     set litButton to the clickOn
  85.     set the castNum of sprite the clickOn to the castNum of sprite the clickOn + 1
  86.     updateStage()
  87.     repeat while soundBusy(1)
  88.     end repeat
  89.     puppetSound(0)
  90.     set the movieRate of sprite QTchannel to 1
  91.     set the sound of cast videoName to 1
  92.     if globalButtonsEnabled then
  93.       set globalButtonsEnabled to 0
  94.       hideOtherActors(me)
  95.     end if
  96.   end if
  97. end
  98.  
  99. on playBackwards me
  100.   if the movieRate of sprite QTchannel <> -1 then
  101.     puppetSound("qtClick")
  102.     set litButton to the clickOn
  103.     set the castNum of sprite the clickOn to the castNum of sprite the clickOn + 1
  104.     updateStage()
  105.     repeat while soundBusy(1)
  106.     end repeat
  107.     puppetSound(0)
  108.     set the movieRate of sprite QTchannel to -1
  109.     set the sound of cast videoName to 0
  110.     if globalButtonsEnabled then
  111.       set globalButtonsEnabled to 0
  112.       hideOtherActors(me)
  113.     end if
  114.   end if
  115. end
  116.  
  117. on globalButtonClick me
  118.   if the movieRate of sprite QTchannel <> 0 then
  119.     pauseQT(me)
  120.     showAllActors()
  121.     set globalButtonsEnabled to 1
  122.   else
  123.     if objectp(gRollAnimButton) then
  124.       click(gRollAnimButton)
  125.     end if
  126.   end if
  127. end
  128.  
  129. on prepareToLeave me
  130.   clearAllActors()
  131.   set globalButtonsEnabled to 0
  132.   set the sound of cast videoName to 0
  133.   set the movieRate of sprite QTchannel to 1
  134.   set the pausedAtStart of cast videoName to 1
  135.   unpuppetAll()
  136.   dispose(slider)
  137.   if not voidp(paletteName) then
  138.     puppetPalette(paletteName)
  139.   else
  140.     puppetPalette(the framePalette)
  141.   end if
  142. end
  143.  
  144. on returnFrom me, buttonObject
  145.   makeButtonJump(buttonObject)
  146.   set the locH of sprite QTchannel to -1000
  147.   updateStage()
  148.   do(returnScript)
  149. end
  150.  
  151. on help me, buttonObject
  152.   birth(script "Help Parent", buttonObject, #QTviewer)
  153. end
  154.